<template>
  <div id="couponinfo">
    <div class="coinfo">
      
      <div class="cotitle">
        <div class="coprice"><span v-if="coupondetail.type !== 'DISCOUNT'">&yen;</span>{{ parseFloat(coupondetail.tnum) }}<span v-if="coupondetail.type === 'DISCOUNT'">折</span></div>
        <!-- <div class="cotitledesc">{{ coupondetail.tbefore }}</div> -->
      </div>
      <div class="codetail">
        <div class="coname">{{ coupondetail.title }}</div>
        <p class="cocode">券码：{{ coupondetail.tcode }}</p>
        <div class="cohold">
          <div class="coleft">使用条件：</div>
          <div class="coright" v-html="coupondetail.tbefore">
          </div>
        </div>
        <div class="cohold">
          <div class="coleft">来源：</div>
          <div class="coright">{{ coupondetail.tfrom }}</div>
        </div>
        <div class="cohold">
          <div class="coleft">有效期：</div>
          <div class="coright">{{ coupondetail.ttamp }}</div>
        </div>
      </div>
      
    </div>
  </div>
</template>

<script>
  export default {
    name: 'couponinfo',
    components: {
    },
    data () {
      return {
        coupondetail: {}
      }
    },
    created () {
      // this.couponList = this.getarr()
      this.getarr().then((data) => {
        this.coupondetail = data
      }, () => {})
      console.log(this.coupondetail)
    },
    methods: {
      getarr: function () {
        return this.$axios.post(this.apidomain + '/api/coupon/getCustCouponDetail/' + this.getCookie('appid'), {
          couponId: this.$route.query.id
        })
        .then((response) => {
          return response.data.data
        })
        .catch(function (error) {
          console.log(error)
          return []
        })
      }
    }
  }
</script>

<style lang="less">
@import '../assets/less/coupon/detail.less';
</style>
